<template>
  <div class="wfull">
    <a-form :labelCol="{ span: 4 }" :wrapperCol="{ span: 20 }">
      <a-form-item label="编码" required>
        <ZgInput v-model="obj.code"></ZgInput>
      </a-form-item>
      <a-form-item label="连接串" required>
        <ZgInput v-model="obj.jdbcUrl"></ZgInput>
      </a-form-item>
      <a-form-item label="用户名" required>
        <ZgInput v-model="obj.username"></ZgInput>
      </a-form-item>
      <a-form-item label="密码" required>
        <ZgInput v-model="obj.passwd"></ZgInput>
      </a-form-item>
      <a-form-item label="驱动类" required>
        <ZgInput v-model="obj.driverClassName"></ZgInput>
      </a-form-item>
    </a-form>
  </div>
</template>
<script>
export default {
  data () {
    return {
      obj: {
        code: '',
        jdbcUrl: '',
        username: '',
        passwd: '',
        driverClassName: ''
      }
    }
  },
  methods: {
    save () {
      if (this.obj.code.length === 0) {
        return this.$result.error('请输入编码')
      }
      if (this.obj.jdbcUrl.length === 0) {
        return this.$result.error('请输入连接串')
      }
      if (this.obj.username.length === 0) {
        return this.$result.error('请输入用户名')
      }
      if (this.obj.passwd.length === 0) {
        return this.$result.error('请输入密码')
      }
      if (this.obj.driverClassName.length === 0) {
        return this.$result.error('请输入驱动类')
      }

      return this.$result.ok(Object.assign({}, this.obj))
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
